using System;
using System.Collections.Generic;

namespace ProgrammingLanguageNr1
{
	public class ASTCreator : Parser
	{
		public ASTCreator (List<Token> tokens) : base(tokens)
		{
			m_ast = new AST(null);
			m_currentChildTree = m_ast;
		}

		protected override void moveDown() {
			m_currentChildTree = m_currentChildTree.getLastChild();
		}
		
		protected override void moveUp() {
			m_currentChildTree = m_currentChildTree.getParent();
		}
		
		protected override void addChildTree(Token token) {
			m_currentChildTree.addChild(token);
		}
		
		public AST getAST() { return m_ast; }
		
		AST m_ast;
		AST m_currentChildTree;
	}
}

